//
//  SupportViewController.m
//  Haier
//
//  Created by aiquantong on 3/14/17.
//  Copyright © 2017 aiquantong. All rights reserved.
//

#import "SupportViewController.h"
#import "CCCallViewController.h"
#import "CCKitManger.h"

#import "ProfileViewController.h"
#import "LoginViewController.h"
#import "CustomLogViewController.h"

#import "UIAlertUtil.h"

@interface SupportViewController ()

@property (nonatomic,strong)IBOutlet UITextField *iphoneTxt;
@property (nonatomic,strong) IBOutlet UISwitch *switchVideo;

@end

@implementation SupportViewController

- (void)viewDidLoad {
    
    [self setLeftNavTitle:@"返回" selector:@selector(onclickback:)];
    
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/**
 返回
 
 @param sender xib
 */
-(void)onclickback:(id)sender
{
    [self.navigationController dismissViewControllerAnimated:YES completion:NULL];
}


/**
 呼叫
 
 @param sender xib指向
 */
-(IBAction)onclickCall:(id)sender
{
    [[CCKitManger shareInstance] showKandyCallViewController:NO
                                                     isVideo:self.switchVideo.isOn
                                                      callee:self.iphoneTxt.text
                                        parentViewController:self];
    [self.view endEditing:YES];
}


/**
 开始多人会议
 
 @param sender xib指向
 */
-(IBAction)onclickMPVStart:(id)sender
{
    [[CCKitManger shareInstance] showKandyMPVWithParentViewController:self.navigationController];
}


/**
 昵称和头像

 @param sender XIB
 */
-(IBAction)onclickSetting:(id)sender
{
    ProfileViewController *svc = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
    [self.navigationController pushViewController:svc animated:YES];
}


/**
 退出
 
 @param sender xib指向
 */
-(IBAction)onclickLogout:(id)sender
{
    [CCKitManger loginoutCallback:^(NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            LoginViewController *login = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
            [self.navigationController setViewControllers:@[login] animated:YES];
        });
    }];
}

/**
 显示日志
 
 @param sender xib指向
 */
-(IBAction)onclickLog:(id)sender
{
    CustomLogViewController *cccall = [[CustomLogViewController alloc] initWithNibName:@"CustomLogViewController" bundle:nil];
    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:cccall];
    [self.navigationController presentViewController:nc animated:YES completion:^{
        
    }];
}


-(IBAction)onclickCurUser:(id)sender
{
    NSString *curUserId = [CCKitManger getcurLoginUser];
    [UIAlertUtil showAlertWithTitle:@"当前用户"
                            message:curUserId
              persentViewController:self];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
